<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="icon" type="image/gif" href="slike/animated_favicon1.gif">
<script src="skripte/Cookies.js"></script>
<script src="skripte/proba1.js"></script>
<script src="jQuery/jquery-1.10.2.js"></script>
<script src="skripte/WSLinije.js" charset="UTF-8"></script>
<link rel="icon" type="image/gif" href="slike/animated_favicon1.gif">

<LINK href="stilovi/users.css" rel="stylesheet" type="text/css">
<LINK href="stilovi/srednjeDugme.css" rel="stylesheet" type="text/css">
<LINK href="stilovi/navigacija.css" rel="stylesheet" type="text/css">
<link rel="icon" type="image/gif" href="slike/animated_favicon1.gif">
<LINK href="stilovi/coda-slider.css" rel="stylesheet" type="text/css">
<LINK href="stilovi/templatemo_style.css" rel="stylesheet" type="text/css">
<LINK href="stilovi/login.css" rel="stylesheet" type="text/css">
<title>Linije</title>


</head>
<body>

<div id="slider">

	<div id="templatemo_main">
    	<ul id="social_box">
            <h1> Javna saobraćajna mreža Bosne i Hercegovine </h1>         
        </ul>
        
        <div id="content">
     
            <div class="scroll">
                <div class="scrollContainer">
                
                    <div class="panel" id="home">
                 	<input type="button" class="btn" value="Nazad" onclick="location.href='index.html';">
                 	<br><br>	
					
					Filter: <input type="text" id="filter" onkeyup="filtriraj()">
					<!-- <button type="button" onClick="filtriraj()" >Filtriraj</button>-->
					<br><br>
					<h4>Postojeće linije:</h4>
					<button type='button' onClick="sortirajPoCijeni()">Sortiraj po cijeni</button>
					<div id="sve_role" style="clear:both">
					<table id="tblRole" border=0 align="left">
					<tr>
						<th>Naziv Linije</th>
						<th>Cijena vožnje</th>
						<th>ID Mape</th>
						<th>Prevoznik</th>
						<th>Tip Saobraćaja</th>	
					</tr>
					</table>
					</div>
			
					<script type="text/javascript">

					var linije=new Array();


					function insertLinija(arg1,arg2,arg3,arg4,arg5,id){
	
					linije.push(arg1,arg2,arg3,arg4,arg5,id);
					//alert(id);
					var fja1="brisanje('"+id+"')";
					var idi="mapaStanice.html?idlinije="+id;
					$('#tblRole').append("<tr>"
					+"<tr><td><name='"+arg1+"' value='"+arg1+"'>"+arg1+"</td>"
					+"<td>"+arg2+"</td>"
					+"<td>"+arg3+"</td>"
					+"<td>"+arg4+"</td>"
					+"<td>"+arg5+"</td>"
					+"<td><button type='button' onClick="+fja1+">Obrisi liniju</button></td>"
					+"<td><a href="+idi+">Prikaži stanice</a>");
		
					}
					function brisanje(sta){
					brisiLiniju(sta);
					}

					var req = createRequest(); // defined above
					//Create the callback:
					req.onreadystatechange = function() {
					if (req.readyState != 4) return; // Not there yet
					if (req.status != 200) {
 					// Handle request failure here...
 					return;
					}
					// Request successful, read the response
					var resp1 = req.responseXML.getElementsByTagName("nazivLinije");
					var resp2 = req.responseXML.getElementsByTagName("cijenaVoznje");
					// ... and use it as needed by your app.

					for (var i=0;i<resp1.length;i++)
	  				{
	  				 var linija=resp1[i].childNodes[0].nodeValue;
	 				 var cijena=resp2[i].childNodes[0].nodeValue;
	 				 $('#sve_role').append("<div class='userDiv'><a href=role.html?linija="+linija+">"+linija+"+&cijena="+cijena+">"+cijena+"</a></div>")
				  }
	  
				return;
				}
				req.open("GET","korisno/linije/filtriranje", true);
				req.send();


				function filtriraj()
				{
				$('#sve_role').empty();
				var req = createRequest(); // defined above
				// Create the callback:
				req.onreadystatechange = function() {
   			  if (req.readyState != 4) return; // Not there yet
			  if (req.status != 200) {
			    // Handle request failure here...
			    return;
			  }
			  // Request successful, read the response
	 		 var resp = req.responseXML.getElementsByTagName("nazivLinije");
	 		 // ... and use it as needed by your app.
	   
			  for (var i=0;i<resp.length;i++)
				  {
				  var linije=resp[i].childNodes[0].nodeValue;
				  $('#sve_role').append("<div class='userDiv'><a href=linije.html?linije="+linije+">"+linije+"</a></div>")
				  }
		  
				  return;
				}
				req.open("GET","korisno/linije/filtriranje?filter="+$('#filter').val(), true);
				req.send();
	
				}
				function sortirajPoCijeni(){
	
				$('#sve_role').empty();
				var req = createRequest(); // defined above
				// Create the callback:
				req.onreadystatechange = function() {
	 			 if (req.readyState != 4) return; // Not there yet
	 			 if (req.status != 200) {
	 		   // Handle request failure here...
	 			   return;
	 			 }
	 		 // Request successful, read the response
	 		 var resp = req.responseXML.getElementsByTagName("nazivLinije");
	 		 // ... and use it as needed by your app.
	   
	 		 for (var i=0;i<resp.length;i++)
				  {
					  var linije=resp[i].childNodes[0].nodeValue;
					  $('#sve_role').append("<div class='userDiv'><a href=linije.html?linije="+linije+">"+linije+"</a></div>")
				  }
		  
				  return;
				}
				req.open("GET","korisno/linije/sortiranje", true);
				req.send();
	
		}

				ucitajLinije();
			</script>	
            <br> <br> <br> <br> <br> <br> <br> <br> <br>
						<h4><a href="urednik.html">Prikaži linije na mapi... </a></h4>
						
						
        	            </div>             
        	        
                 
						</div>
                    </div>
                
                </div>
			</div>

        </div> 
</body>
</html>